package com.itbaizhan.shopping_pay_service.config;

/**
 * @author spf
 * @date 2024/1/20
 * @time 20:34
 */

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 支付宝配置类
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "alipay")
public class ZfbPayConfig {

    private String appId;
    private String privateKey;
    private String publicKey;
    private String gateway;
    private String notifyUrl;
    private String pcNotify;

    @Bean
    public AlipayClient setAliPayClient(){
        return new DefaultAlipayClient(gateway, appId, privateKey, "json", "utf-8", publicKey, "RSA2");
    }

}
